<template>
	<view class="page">
		<u-navbar :title="title" autoBack fixed placeholder titleStyle="color: #232832" bgColor="#FFFFFF"
			leftIconColor="#232832"></u-navbar>
		<c-content :top="statusBarHeight + 44" :bottom="safeAreaBottom" padding="0 22px">
			<view class="search">
				<u-search placeholder="用户名称" :showAction="false" shape="square" bgColor="#F4F4F7"></u-search>
			</view>
			<z-paging ref="paging" fixed refresher-only class="paging" :data-key="41"
				:style="{top: `${statusBarHeight + 44 + 44 + 12}px`, bottom: `${safeAreaBottom}px`}" refresher-vibrate
				refresher-background="transparent" safe-area-inset-bottom @query="onRefresh" show-refresher-when-reload
				show-refresher-update-time refresher-update-time-key="data" @scroll="onScroll">
				<view class="cell-content">
					<view class="cell" v-for="i in 10" :key="i" @click.self="goDetail()">
						<view class="cell-icon">
							<u-avatar src="/static/1.png" :size="40"></u-avatar>
						</view>
						<view class="nickname">哈哈哈哈</view>
						<view class="controll">
							<view class="btn primary" @click.self.stop="goChat()">
								<text class="icon-comment"></text>
							</view>
							<view class="btn" @click.self.stop="addAttention()">
								<text class="icon-focus"></text>
							</view>
						</view>
					</view>
				</view>
			</z-paging>
		</c-content>
	</view>
</template>

<script>
	import mixins from '@/mixins/index.js'
	export default {
		mixins: [mixins],
		data() {
			return {
				title: '',
				type: '0'
			}
		},
		methods: {
			goDetail() {
				uni.navigateTo({
					url: '/pages/common/user'
				})
			},
			goChat() {
				uni.navigateTo({
					url: '/pages/common/chat'
				})
			},
			addAttention() {
				console.log(1111);
			}
		},
		onLoad(options) {
			this.type = options.type
			if (options.type == '0') {
				this.title = '我的关注'
			} else if (options.type == '1') {
				this.title = '我的粉丝'
			} else if (options.type == '2') {
				this.title = '我的朋友'
			}
		}
	}
</script>

<style scoped lang="scss">
	.search {
		display: flex;
		align-items: center;
		height: 44px;
		margin: 6px 0;
	}

	.cell {
		display: flex;
		align-items: center;
		padding: 10px 0;
		margin: 0 22px;

		.nickname {
			flex: 1;
			margin: 0 5px 0 10px;
			color: #232832;
			font-size: 15px;
			line-height: 18px;
			font-weight: 400;
		}

		.controll {
			display: flex;
			align-items: center;
			justify-content: center;
		}

		.btn {
			display: flex;
			align-items: center;
			justify-content: center;
			width: 16px;
			height: 16px;
			padding: 8px;
			margin-left: 10px;
			background-color: #F4F4F7;
			border-radius: 50%;

			[class^=icon] {
				color: #232832;
				font-size: 13px;
			}

			&.primary {
				background-color: #6E86FF;

				text {
					color: #FFFFFF;
				}
			}
		}
	}
</style>